app_family.controller("controller_call", function($scope, $rootScope, httpRequest, $location) {
	$rootScope.$broadcast('currentModule', 'page_call');
	$rootScope.$broadcast('footerFlag', false); // 是否显示底部导航
	
	$scope.imagebasepath = imagebasepath;
	
	/**
	 * 判断是否用手机登录过
	 */
	if (sessionStorage.getItem('data_sessionStorage')) {
		var familyPhone = JSON.parse(sessionStorage.getItem('data_sessionStorage')).familyInfo.phone;
		if (familyPhone == '' || familyPhone == null) {
			window.location.replace(basepath + 'login.html');
			return;
		}
	} else {
		window.location.replace(basepath + 'login.html');
		return;
	}
	
	/**
	 * 获取列表 若未绑定，跳往绑定页面
	 */
	var data = {
		success: true,
		obj: [{
			icon: '',
			mobile: '15251782346',
			sex: '2',
			name: 'Miya',
			junciCode: '242343'
		}, {
			icon: '',
			mobile: '15251782346',
			sex: '2',
			name: 'Miya',
			junciCode: '242343'
		}, {
			icon: '',
			mobile: '15251782346',
			sex: '2',
			name: 'Miya',
			junciCode: '242343'
		}]
	};
	if (data.success === true) {
		$scope.familyList = data.obj;
		// 未绑定 跳转到绑定页面
		if (data.obj.length == 0) {
			$.dialog.showDialog({
				msgTxt : '您还没有绑定，现在去绑定一位就可以进行一键呼叫啦~',
				isShowBtnCancel : false,
				callbackOk : function () {
					// 记录从哪个页面跳转到绑定页面
					data_sessionStorage = JSON.parse(sessionStorage.getItem('data_sessionStorage'));
			    	data_sessionStorage.record_page.page_bind.from = '/call';
			    	sessionStorage.setItem('data_sessionStorage', JSON.stringify(data_sessionStorage));
			    	
					$location.path('/bind');
					$scope.$apply();
				}
			});
		}
	} else if (data.success === false) {
		$.dialog.showToast({msgTxt : data.msg});
	}
});